//
//  AXFShoppingCarViewController.m
//  AIXF
//
//  Created by Macx on 2017/7/9.
//  Copyright © 2017年 Macx. All rights reserved.
//

#import "AXFShoppingCarViewController.h"
#import "UILabel+Addition.h"
#import <Masonry.h>
#import "NSAttributedString+Additon.h"

@interface AXFShoppingCarViewController ()
@property(nonatomic,strong)UIImageView *HomeImageView;
@property(nonatomic,strong)UILabel *textLabel;
//@property(nonatomic,strong)UIButton *GoShoppingButton;
@end

@implementation AXFShoppingCarViewController



- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    //设置导航栏的返回按钮
    [self.navigationController.navigationBar setBackgroundImage: [UIImage imageNamed:@""]forBarMetrics:UIBarMetricsDefault];
    //返回按钮
    UIBarButtonItem *disItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"v2_goback"] style:UIBarButtonItemStylePlain target:self action:@selector(dismiss)];
    self.navigationController.navigationBar.tintColor = [UIColor blackColor];
    self.navigationItem.leftBarButtonItem = disItem;
    
    
    [self setupCarHome];
}

- (void)dismiss
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

//空购物车,主界面
-(void)setupCarHome{
    
    //图片
    self.HomeImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"v2_shop_empty"]];
    [self.view addSubview:self.HomeImageView];
    [self.HomeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.offset(110);
        make.top.offset(200);
        make.centerX.equalTo(self.view);
    }];
    
    //字体
    self.textLabel = [UILabel makeLabelWithTextColor:[UIColor lightGrayColor] andTextWithFont:17 andText:@"亲,购物车空空的耶~赶紧挑选好吃的吧"];
    self.textLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:self.textLabel];
    [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(self.view);
        make.top.equalTo(self.HomeImageView.mas_bottom).offset(20);
        make.centerX.equalTo(self.view);
    }];
    
    //去逛逛
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(100, 100, 150, 150);
    [btn setBackgroundImage:[UIImage imageNamed:@"btn.png"] forState:UIControlStateNormal];
    [btn setTitle:@"逛一逛" forState:UIControlStateNormal];
    [btn  setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    btn.titleLabel.textAlignment = NSTextAlignmentCenter;
    btn.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.view addSubview:btn];
    
    //监听方法
    [btn addTarget:self action:@selector(ChilckButton) forControlEvents:UIControlEventTouchUpInside];
    
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.textLabel.mas_bottom).offset(30);
        make.width.offset(125);
        make.height.offset(40);
        make.centerX.equalTo(self.view);
        
    }];

}

-(void)ChilckButton{
  [self dismissViewControllerAnimated:YES completion:nil];
    
    
}



@end
